/*
 * XML Type:  embeddable-attributes
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EmbeddableAttributes
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML embeddable-attributes(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class EmbeddableAttributesImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EmbeddableAttributes
{

    /**  */
	private static final long serialVersionUID = 5204401455389948849L;


	public EmbeddableAttributesImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName BASIC$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "basic");
    private static final javax.xml.namespace.QName TRANSIENT$2 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "transient");


    /**
     * Gets a List of "basic" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic> getBasicList()
    {
        final class BasicList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic get(int i)
                { return EmbeddableAttributesImpl.this.getBasicArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic old = EmbeddableAttributesImpl.this.getBasicArray(i);
                EmbeddableAttributesImpl.this.setBasicArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic o)
                { EmbeddableAttributesImpl.this.insertNewBasic(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic old = EmbeddableAttributesImpl.this.getBasicArray(i);
                EmbeddableAttributesImpl.this.removeBasic(i);
                return old;
            }

            @Override
			public int size()
                { return EmbeddableAttributesImpl.this.sizeOfBasicArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new BasicList();
        }
    }

    /**
     * Gets array of all "basic" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic[] getBasicArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(BASIC$0, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "basic" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic getBasicArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic)get_store().find_element_user(BASIC$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "basic" element
     */
    public int sizeOfBasicArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(BASIC$0);
        }
    }

    /**
     * Sets array of all "basic" element
     */
    public void setBasicArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic[] basicArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(basicArray, BASIC$0);
        }
    }

    /**
     * Sets ith "basic" element
     */
    public void setBasicArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic basic)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic)get_store().find_element_user(BASIC$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(basic);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "basic" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic insertNewBasic(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic)get_store().insert_element_user(BASIC$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "basic" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic addNewBasic()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Basic)get_store().add_element_user(BASIC$0);
            return target;
        }
    }

    /**
     * Removes the ith "basic" element
     */
    public void removeBasic(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(BASIC$0, i);
        }
    }

    /**
     * Gets a List of "transient" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient> getTransientList()
    {
        final class TransientList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient get(int i)
                { return EmbeddableAttributesImpl.this.getTransientArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient old = EmbeddableAttributesImpl.this.getTransientArray(i);
                EmbeddableAttributesImpl.this.setTransientArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient o)
                { EmbeddableAttributesImpl.this.insertNewTransient(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient old = EmbeddableAttributesImpl.this.getTransientArray(i);
                EmbeddableAttributesImpl.this.removeTransient(i);
                return old;
            }

            @Override
			public int size()
                { return EmbeddableAttributesImpl.this.sizeOfTransientArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new TransientList();
        }
    }

    /**
     * Gets array of all "transient" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient[] getTransientArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(TRANSIENT$2, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "transient" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient getTransientArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient)get_store().find_element_user(TRANSIENT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "transient" element
     */
    public int sizeOfTransientArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(TRANSIENT$2);
        }
    }

    /**
     * Sets array of all "transient" element
     */
    public void setTransientArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient[] xtransientArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(xtransientArray, TRANSIENT$2);
        }
    }

    /**
     * Sets ith "transient" element
     */
    public void setTransientArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient xtransient)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient)get_store().find_element_user(TRANSIENT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(xtransient);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "transient" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient insertNewTransient(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient)get_store().insert_element_user(TRANSIENT$2, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "transient" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient addNewTransient()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.Transient)get_store().add_element_user(TRANSIENT$2);
            return target;
        }
    }

    /**
     * Removes the ith "transient" element
     */
    public void removeTransient(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(TRANSIENT$2, i);
        }
    }
}
